package com.aaa.choose.service.impl;
import com.aaa.choose.dao.SelectAllCarDao;
import com.aaa.choose.service.SelectAllCarService;
import com.aaa.entity.Car;
import com.aaa.vo.CarVo;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wys
 * @version 1.0
 * @date 2023/3/6 18:54
 */
@Service
public class SelectAllCarServiceImpl implements SelectAllCarService{
    @Autowired
    private SelectAllCarDao selectAllCarDao;
    @Override
    public Result selectAllCar(CarVo carVo) {
//        QueryWrapper<Car> wrapper = new QueryWrapper<>();
//        wrapper.eq("type",carVo.getType());
//        wrapper.orderByAsc(carVo.getSelectId()==0 || carVo.getSelectId()==null || carVo.getSelectId()==' ',"id");
//        wrapper.orderByAsc(carVo.getSelectId()==1,"price");
//        wrapper.orderByDesc(carVo.getSelectId()==2,"price");
//        wrapper.orderBy(carVo.getSelectId()==3,true,"brand_id");
        List<Car> cars = selectAllCarDao.selectCarList(carVo);
        return new Result(200,"查询成功",cars);
    }
}
